package com.ylz.sjzx.sio.common.core.utils;

import lombok.SneakyThrows;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.io.ClassPathResource;

import java.util.Properties;

/**
 * yml配置文件获取
 *
 * @version 1.0
 * @date 2021/3/23
 */
public class YmlUtil {

    public static Properties properties;

    static {
        YamlPropertiesFactoryBean yamlMapFactoryBean = new YamlPropertiesFactoryBean();
        yamlMapFactoryBean.setResources(new ClassPathResource("application.yml"));
        properties = yamlMapFactoryBean.getObject();

    }

    /**
     * 获取im服务的host
     *
     * @return
     */
    @SneakyThrows
    public static String getImServiceHost() {
        return YmlUtil.properties.getProperty("im.group.service.port");
    }


}
